package service

import (
	"context"
	__ "user_service/basic/proto"
	"user_service/model"
)

// server is used to implement helloworld.GreeterServer.
type Server struct {
	__.UnimplementedUserServer
}

// SayHello implements helloworld.GreeterServer
func (s *Server) AddWorks(_ context.Context, in *__.AddWorksReq) (*__.AddWorksResp, error) {
	var w model.Works
	w.GetUserBy(in.Name)

	w = model.Works{
		Name:        in.Name,
		Describe:    in.Describe,
		Association: in.Association,
	}

	w.Create()

	return &__.AddWorksResp{
		Code: 200,
		Msg:  "添加成功",
	}, nil
}
